package com.shuhe.domain.mxgc;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class DataObject {
    private String tagName;
    private String tagTime;
    private String tagValue;

    // 构造函数
    public DataObject(String tagName, String tagTime, String tagValue) {
        this.tagName = tagName;
        this.tagTime = tagTime;
        this.tagValue = tagValue;
    }

    // Getter和Setter方法
    public String getTagName() {
        return tagName;
    }

    public void setTagName(String tagName) {
        this.tagName = tagName;
    }

    public String getTagTime() {
        return tagTime;
    }

    public void setTagTime(String tagTime) {
        this.tagTime = tagTime;
    }

    public String getTagValue() {
        return tagValue;
    }

    public void setTagValue(String tagValue) {
        this.tagValue = tagValue;
    }
    public static void main(String[] args) {
        // 组装数据
        ArrayList<DataObject> dataObjects = new ArrayList<DataObject>();
        DataObject dataObject = new DataObject("1$QTGYW", "2024-12-03 14:46:06", "2.4240");
        dataObjects.add(dataObject);
        DataObject dataObject2 = new DataObject("1$QTGTT", "2024-12-03 14:46:06", "4.6500");
        dataObjects.add(dataObject2);
        Map<String, ArrayList<DataObject>> datas = new HashMap<>();
        datas.put("datas", dataObjects);

        // 访问对象的属性
        System.out.println(JSON.toJSONString(datas));
        System.out.println("Extra String: " + dataObject.getTagName());
        System.out.println("Message: " + dataObject.getTagTime());
        System.out.println("Status: " + dataObject.getTagValue());
    }
}
